<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./js/jquery-3.3.1.min.js"></script>
    <script>
        $(function() {
            // $.ajax({
            // type:"get",
            // url:"./00 data.json",
            // //data:{id:10001},//请求参数
            // //data:"id=10001&name=zhangsan",application/x-www-form-urlencoded
            // //contentType:"json",//请求格式 参数的格式
            // dataType:"json",//返回数据格式
            // success:function(data){
            //     console.log(data);
            //     if(data.status===200){
            //         var cls = data.data;
            //         $("lengend").text(cls.name);
            //         var students = cls.student;
            //         for (let index = 0; index < students.length; index++) {
            //             const stu = students[index];
            //             $(".data tbody").append("<tr><td>"+stu.id+"</td><td>"+stu.name+"</td></tr>");
            //         }
                    
            //     }else{
            //         console.log(data.msg)
            //     }
            // },
            // error: function(res) {
            //     console.log(res);
            // }
            // }) url [data] success [dataType]
            $.get("./00 data.json",function (data){
                if(data.status===200){
                    var cls = data.data;
                    $("lengend").text(cls.name);

                    var students = cls.student;
                    for (let index = 0; index < students.length; index++) {
                        const stu = students[index];
                        $(".data tbody").append("<tr><td>"+stu.id+"</td><td>"+stu.name+"</td></tr>");
                    }
                    
                }else {
                    console.log(data.msg);
                }
         
            
          
            })
        })

    </script>
</head>
<body>
   
        <legend></legend>
        <table class="data">
        <thead>
            <th>id</th>
            <th>name</th>
        </thead>
        <tbody>
     <!-- <tr></tr> -->
        </tbody>
    </table>
</body>
</html>